//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "ClientUnit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "IdBaseComponent"
#pragma link "IdCmdTCPClient"
#pragma link "IdComponent"
#pragma link "IdContext"
#pragma link "IdTCPClient"
#pragma link "IdTCPConnection"
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
   : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
   IdCmdTCPClient1->Host = "127.0.0.2";
   IdCmdTCPClient1->Port = 1234;

   IdCmdTCPClient1->Connect();



}
//---------------------------------------------------------------------------
void __fastcall TForm2::IdCmdTCPClient1Status(TObject *ASender, const TIdStatus AStatus,
          const UnicodeString AStatusText)
{
   Memo1->Lines->Add(AStatus + "__" + AStatusText);
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Memo1KeyDown(TObject *Sender, WORD &Key, TShiftState Shift)

{
if (Key != VK_RETURN) return;

   int linelast = Memo1->Lines->Count-1;
   UnicodeString kkkk = Memo1->Lines->Strings[linelast];


   if (IdCmdTCPClient1->Connected())
   {
     if (IdCmdTCPClient1->Connected())
         //IdCmdTCPClient1->SendCmd(kkkk);
         IdCmdTCPClient1->Socket->WriteLn(kkkk);
   }
}
//---------------------------------------------------------------------------

void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
   if (IdCmdTCPClient1->Connected())
         IdCmdTCPClient1->Disconnect();
}
//---------------------------------------------------------------------------

























